package com.magold.sprite;

import org.andengine.entity.IEntity;
import org.andengine.entity.shape.IShape;
import org.andengine.entity.sprite.AnimatedSprite.IAnimationListener;
import org.andengine.entity.sprite.IAnimationData;
import org.andengine.input.touch.TouchEvent;
import org.andengine.opengl.shader.ShaderProgram;
import org.andengine.opengl.texture.region.ITextureRegion;
import org.andengine.opengl.texture.region.ITiledTextureRegion;
import org.andengine.opengl.vbo.IVertexBufferObject;
import org.andengine.opengl.vbo.VertexBufferObjectManager;

public class MultiTextureSpriteFilter extends EntityFilter implements IMultiTextureSprite {
	protected IMultiTextureSprite mSprite;

	public MultiTextureSpriteFilter(IMultiTextureSprite pSprite) {
		mSprite = pSprite;
	}
	
	@Override
	protected IEntity getWrappedEntity() {
		return mSprite;
	}
	
	public IMultiTextureSprite getWrappedSprite() {
		return mSprite;
	}

	@Override
	public float getWidth() {
		return mSprite.getWidth();
	}

	@Override
	public float getHeight() {
		return mSprite.getHeight();
	}

	@Override
	public float getWidthScaled() {
		return mSprite.getWidthScaled();
	}

	@Override
	public float getHeightScaled() {
		return mSprite.getHeightScaled();
	}

	@Override
	public void setHeight(float pHeight) {
		mSprite.setHeight(pHeight);
	}

	@Override
	public void setWidth(float pWidth) {
		mSprite.setWidth(pWidth);
	}

	@Override
	public void setSize(float pWidth, float pHeight) {
		mSprite.setSize(pWidth, pHeight);
	}

	@Override
	public boolean collidesWith(IShape pOtherShape) {
		return mSprite.collidesWith(pOtherShape);
	}

	@Override
	public boolean isBlendingEnabled() {
		return mSprite.isBlendingEnabled();
	}

	@Override
	public void setBlendingEnabled(boolean pBlendingEnabled) {
		mSprite.setBlendingEnabled(pBlendingEnabled);
	}

	@Override
	public int getBlendFunctionSource() {
		return mSprite.getBlendFunctionSource();
	}

	@Override
	public int getBlendFunctionDestination() {
		return mSprite.getBlendFunctionDestination();
	}

	@Override
	public void setBlendFunctionSource(int pBlendFunctionSource) {
		mSprite.setBlendFunctionSource(pBlendFunctionSource);
	}

	@Override
	public void setBlendFunctionDestination(int pBlendFunctionDestination) {
		mSprite.setBlendFunctionDestination(pBlendFunctionDestination);
	}

	@Override
	public void setBlendFunction(int pBlendFunctionSource,
			int pBlendFunctionDestination) {
		mSprite.setBlendFunction(pBlendFunctionSource, pBlendFunctionDestination);
	}

	@Override
	public VertexBufferObjectManager getVertexBufferObjectManager() {
		return mSprite.getVertexBufferObjectManager();
	}

	@Override
	public IVertexBufferObject getVertexBufferObject() {
		return mSprite.getVertexBufferObject();
	}

	@Override
	public ShaderProgram getShaderProgram() {
		return mSprite.getShaderProgram();
	}

	@Override
	public void setShaderProgram(ShaderProgram pShaderProgram) {
		mSprite.setShaderProgram(pShaderProgram);
	}

	@Override
	public boolean contains(float pX, float pY) {
		return mSprite.contains(pX, pY);
	}

	@Override
	public boolean onAreaTouched(TouchEvent pSceneTouchEvent,
			float pTouchAreaLocalX, float pTouchAreaLocalY) {
		return mSprite.onAreaTouched(pSceneTouchEvent, pTouchAreaLocalX, pTouchAreaLocalY);
	}

	@Override
	public void setAnimationIndex(int animationIndex, boolean autoStart) {
		mSprite.setAnimationIndex(animationIndex, autoStart);
	}

	@Override
	public void put(int key, ITiledTextureRegion value) {
		mSprite.put(key, value);
	}

	@Override
	public int getCurrentTextureKey() {
		return mSprite.getCurrentTextureKey();
	}

	@Override
	public boolean isAnimationRunning() {
		return mSprite.isAnimationRunning();
	}

	@Override
	public void animate() {
		mSprite.animate();
	}

	@Override
	public void animate(long pFrameDurationEach) {
		mSprite.animate(pFrameDurationEach);
	}

	@Override
	public void animate(IAnimationData pAnimationData) {
		mSprite.animate(pAnimationData);
	}

	@Override
	public void animate(long pFrameDurationEach, boolean pLoop,
			IAnimationListener pAnimationListener) {
		mSprite.animate(pFrameDurationEach, pLoop, pAnimationListener);
	}

	@Override
	public void animate(long pFrameDurationEach, int pLoopCount,
			IAnimationListener pAnimationListener) {
		mSprite.animate(pFrameDurationEach, pLoopCount, pAnimationListener);
	}

	@Override
	public int getCurrentTileIndex() {
		return mSprite.getCurrentTileIndex();
	}

	@Override
	public int getTileCount() {
		return mSprite.getTileCount();
	}

	@Override
	public ITiledTextureRegion getTiledTextureRegion() {
		return mSprite.getTiledTextureRegion();
	}

	@Override
	public ITextureRegion getTextureRegion() {
		return mSprite.getTextureRegion();
	}

	@Override
	public boolean isFlippedHorizontal() {
		return mSprite.isFlippedHorizontal();
	}

	@Override
	public void setFlippedHorizontal(boolean pFlippedHorizontal) {
		mSprite.setFlippedHorizontal(pFlippedHorizontal);
	}

	@Override
	public void setFlippedVertical(boolean pFlippedVertical) {
		mSprite.setFlippedVertical(pFlippedVertical);
	}

	@Override
	public void resetRotationCenter() {
		mSprite.resetRotationCenter();
	}

	@Override
	public void resetScaleCenter() {
		mSprite.resetScaleCenter();
	}

	@Override
	public void resetSkewCenter() {
		mSprite.resetSkewCenter();
	}

	@Override
	public int hashCode() {
		return super.hashCode();
	}

	@Override
	public boolean equals(Object o) {
		boolean self = (o == this);
		
		boolean pEqual = self || (o instanceof MultiTextureSpriteFilter) && ((MultiTextureSpriteFilter) o).mSprite == this.mSprite;
		
		return pEqual || mSprite.equals(o);
	}

	@Override
	public void stopAnimation(int pTileIndex) {
		mSprite.stopAnimation(pTileIndex);
	}

	@Override
	public void stopAnimation() {
		mSprite.stopAnimation();
	}
	
}
